<extend name="Public/base" />
<block name="style">
    <style type="text/css">
        body{ background: #fff;}
    </style>
</block>
<block name="body">
    <include file="Public:timepicker" />
    <!-- 弹窗插件 -->
    <include file="Public:artdialog" />
    <!-- 表单验证插件 -->
    <include file="Public:validform" />
    <form action="{:U('')}" method="post" id="formsubmit">
    <div class="row"  >
        <div class="col-md-12" >
            <div class="block-web">
                <div class="header">
                    <h3 class="content-header">授权</h3>
                </div>
                <div class="porlets-content">

                    <div class="form-group">
                        <label class="col-sm-2 control-label"><strong>用户名：</strong></label>
                        <div class="col-sm-10">
                            <strong>{$user['user_name']}</strong>
                            <input type="hidden" name="user_id" value="{$user['user_id']}">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-12">
                            <table style="width: 100%;border: solid 1px #e0eaf6;">
                                <tr>
                                    <th bgcolor="#E8E7E7" height="30" style="padding-left: 10px;" >分配授权</th>
                                </tr>
                                <tr>
                                    <td><label class="checkbox-inline" style="padding-left: 5px;">
                                        <input type="checkbox" id="allCheck">
                                        <span class="custom-checkbox"></span> 全选 </label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                       <div id="auth_group_access" style="width: 100%; padding: 5px;">

                                       </div>
                                    </td>
                                </tr>
                            </table>

                        </div>
                    </div>

                </div>
             </div>
        </div>
    </div>

    <div class="footer" >
        <input type="button" class="btn btn-primary btn-success bt_submit" onclick="submitok()" value="提交">
        <button class="btn btn-default bt_close" type="button" onclick="art.dialog.open.api.close();" >关闭</button>
    </div>
    </form>
</block>
<block name="script">
<script type="text/javascript">
    $(function(){
        var uid="{$user['user_id']}";
        $.ajax({ //no need to judge the browser type
            type: "POST", //类型
            url: "{:U('Auth/auth_group_access_load')}", //请求访问的servlet
            dataType: "html",
            data: {'uid':uid}, //传递的参数
            success: function(returnedData){   //成功返回的回调函数
                $("#auth_group_access").html(returnedData);
            }
        });

        $("#allCheck").change(function(){
            $("#auth_group_access input[type='checkbox']").prop('checked',$(this).is(":checked"));
        });
    });

    function submitok(){
        var action=$("#formsubmit").attr("action");
        var data=$("#formsubmit").serializeArray();
        $.post(action,data,function(resultobj){
            console.info(resultobj);
            var retstatus = resultobj.status == 1 ? "1" : "0";
            showvfmsg(retstatus, resultobj.info, 1900);
        });
    }
</script>
</block>